package com.rupertjones.globalcron.domain.dao;

import com.rupertjones.globalcron.domain.Setting;
import com.rupertjones.globalcron.domain.SettingType;
import org.springframework.stereotype.Repository;

import static org.hibernate.criterion.Restrictions.eq;

/**
 * <p>&copy Rupert Jones 2011,2012</p>
 *
 * @author rup
 */
@Repository
public class SettingDAO extends AbstractHibernateDAO<Setting> {
    public SettingDAO() {
        super(Setting.class);
    }

    public Setting findBy(SettingType type) {
        return (Setting) getCriteria().add(eq("type", type)).uniqueResult();
    }
}
